import useSettingsStore from '@/store/modules/settings'
import {getTitle} from '@/api/api'

/**
 * 动态修改标题
 */
export function useDynamicTitle() {
  const settingsStore = useSettingsStore();
  getTitle().then(res => {
    if (settingsStore.dynamicTitle) {
      document.title = settingsStore.title + ' - ' + res.data;
    } else {
      document.title = res.data;
    }
  })
}